<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page language="java" import=" myUtils.Constants,myUtils.page.*,java.util.*,po.*"%>
<s:include value="/layout/header.jsp" />
<SCRIPT language="javascript" src="js/page-navigater.js"></SCRIPT>
<%
        Result result = (Result) request.getAttribute("result");
        List content = result.getContent();
        Page p = result.getPage();


%>
<!-- B.1 MAIN CONTENT -->
<div class="main-content">

    <h1 class="pagetitle">收件箱</h1>

    <div class="column1-unit">

        <%if (content.isEmpty()) {%>
        <p>暂未收到任何邮件
        <%}else{%>
        <table>
            <tr><th class="top" scope="col">邮件状态</th>
                <th class="top" scope="col">标题</th>
                <th class="top" scope="col">发信人</th>
                <th class="top" scope="col">发信时间</th>
                <th class="top" scope="col">操作</th>
            </tr>
            <%for (int i = 0; i < content.size(); ++i) {
            Mail mail = (Mail) content.get(i);
            %>
            <tr><th scope="row"><%=(mail.getIsread() > 9) ? "已读" : "未读"%></th>
                <td><%=mail.getTitle()%></td>
                <td><%=mail.getUserByFromId().getName()%></td>
                <td><%=mail.getTime().toLocaleString()%></td>
                <td><a href="showMailDetail.action?mailId=<%=mail.getId()%>">查看详细</a>
            |<a href="deleteMail.action?mailId=<%=mail.getId()%>">删除</a></td></tr>
            <%}%>
        </table>
        <script language="javascript">
            pager = new PageNavigater(<%=p.getTotalPage()%>,<%=p.getCurrentPage()%>, "myNewsList.action?") ;document.write(pager);</script>
        <%}%>
   </div>

    <hr class="clear-contentunit" />




</div>


</div>
<s:include value="/layout/footer.jsp"/>